/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.oa.action.communication;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.oa.mapper.communication.EmailMapper;
public class EmailAction extends BaseAction
{
    @Autowired(required=false)
	private EmailMapper mapper;
    /**
    新邮件
    */
    
    public Map newEmail() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object contact_id =mapper.contact_id(params);
        result.put("contact_id", contact_id);
        
        
        SQLList<SQLMap> s_email=mapper.s_email(params);
        SQLMap s_email_emt=s_email.getExistfirst();
        result.put("s_email", s_email_emt);
        
        
        SQLList<SQLMap> s_relation=mapper.s_relation(params);
        SQLMap s_relation_emt=s_relation.getExistfirst();
        result.put("s_relation", s_relation_emt);
        
        
        SQLList<SQLMap> s_mail=mapper.s_mail(params);
        result.put("s_mail", s_mail);
        
        return result;
    }
    /**
    选择公共文件
    */
    
    public Map pubFileChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> accounts=mapper.accounts(params,pagination);
        accounts.setPagedListInfo(pagination);
        result.put("accounts", accounts);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        
        
        return result;
    }
    /**
    选择邮箱
    */
    
    public Map emailChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_mail=mapper.s_mail(params);
        result.put("s_mail", s_mail);
        
        return result;
    }
    /**
    选择客户邮箱
    */
    
    public Map customerChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_sclient=mapper.s_sclient(params,pagination);
        s_sclient.setPagedListInfo(pagination);
        result.put("s_sclient", s_sclient);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        return result;
    }
    /**
    选择联系人邮箱
    */
    
    public Map emailContactsChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_sclient=mapper.s_sclient(params,pagination);
        s_sclient.setPagedListInfo(pagination);
        result.put("s_sclient", s_sclient);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        return result;
    }
    /**
    选择员工邮箱
    */
    
    public Map emailStaffChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_user_info=mapper.s_user_info(params,pagination);
        s_user_info.setPagedListInfo(pagination);
        result.put("s_user_info", s_user_info);
        
        
        SQLList<SQLMap> s_type=mapper.s_type(params);
        SQLMap s_type_emt=s_type.getExistfirst();
        result.put("s_type", s_type_emt);
        
        return result;
    }
    /**
    选择个人文件
    */
    
    public Map personalFileChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> accounts=mapper.accounts(params,pagination);
        accounts.setPagedListInfo(pagination);
        result.put("accounts", accounts);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        
        
        
        
        return result;
    }
    /**
    选择公司文件
    */
    
    public Map companyFileChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> accounts=mapper.accounts(params,pagination);
        accounts.setPagedListInfo(pagination);
        result.put("accounts", accounts);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        return result;
    }
    /**
    选择本地文件
    */
    
    public Map localFileChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> accounts=mapper.accounts(params,pagination);
        accounts.setPagedListInfo(pagination);
        result.put("accounts", accounts);
        
        
        SQLList<SQLMap> s_1=mapper.s_1(params);
        result.put("s_1", s_1);
        
        return result;
    }
    /**
    选择图片
    */
    
    public Map pictureChoice() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> accounts=mapper.accounts(params,pagination);
        accounts.setPagedListInfo(pagination);
        result.put("accounts", accounts);
        
        return result;
    }
    /**
    发件箱
    */
    
    public Map sendEmail() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_mailing=mapper.s_mailing(params,pagination);
        s_mailing.setPagedListInfo(pagination);
        s_mailing.setSelectNone("发送情况明细");
        result.put("s_mailing", s_mailing);
        
        return result;
    }
    /**
    发件明细
    */
    
    public Map outboxDetailed() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        
        
        
        
        SQLList<SQLMap> t_send=mapper.t_send(params);
        SQLMap t_send_emt=t_send.getExistfirst();
        result.put("t_send", t_send_emt);
        
        
        SQLList<SQLMap> s_recipient=mapper.s_recipient(params);
        s_recipient.setSelectNone("发送邮箱");
        result.put("s_recipient", s_recipient);
        
        
        SQLList<SQLMap> s_file=mapper.s_file(params);
        s_file.setSelectNone("发送附件");
        result.put("s_file", s_file);
        
        return result;
    }
    /**
    收件箱
    */
    
    public Map receiveEmail() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_account=mapper.s_account(params);
        result.put("s_account", s_account);
        
        
        Object CMID2 =mapper.CMID2(params);
        result.put("CMID2", CMID2);
        
        
        Object CMID1 =mapper.CMID1(params);
        result.put("CMID1", CMID1);
        
        
        SQLList<SQLMap> s_relation=mapper.s_relation(params);
        result.put("s_relation", s_relation);
        
        return result;
    }
    /**
    收信
    */
    
    public Map receiver() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_account=mapper.s_account(params);
        SQLMap s_account_emt=s_account.getExistfirst();
        result.put("s_account", s_account_emt);
        
        
        SQLList<SQLMap> l_mail=mapper.l_mail(params,pagination);
        l_mail.setPagedListInfo(pagination);
        result.put("l_mail", l_mail);
        
        return result;
    }
    /**
    邮件明细
    */
    
    public Map emailDetailed() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> t_mail=mapper.t_mail(params);
        SQLMap t_mail_emt=t_mail.getExistfirst();
        result.put("t_mail", t_mail_emt);
        
        
        SQLList<SQLMap> fujianmingxi=mapper.fujianmingxi(params);
        result.put("fujianmingxi", fujianmingxi);
        
        return result;
    }
    /**
    转发邮件
    */
    
    public Map emailForward() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object contact_id =mapper.contact_id(params);
        result.put("contact_id", contact_id);
        
        
        SQLList<SQLMap> s_mail=mapper.s_mail(params);
        SQLMap s_mail_emt=s_mail.getExistfirst();
        result.put("s_mail", s_mail_emt);
        
        
        SQLList<SQLMap> fujianmingxi=mapper.fujianmingxi(params);
        result.put("fujianmingxi", fujianmingxi);
        
        return result;
    }
    /**
    邮箱设置
    */
    
    public Map mailboxSetting() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_email=mapper.s_email(params);
        result.put("s_email", s_email);
        
        return result;
    }
    /**
    修改邮箱信息
    */
    
    public Map mailboxInformationUp() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_acc=mapper.s_acc(params);
        SQLMap s_acc_emt=s_acc.getExistfirst();
        result.put("s_acc", s_acc_emt);
        
        return result;
    }
    /**
    修改授权码
    */
    
    public Map modifyAuthorization() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_acc=mapper.s_acc(params);
        SQLMap s_acc_emt=s_acc.getExistfirst();
        result.put("s_acc", s_acc_emt);
        
        return result;
    }
    /**
    修改QQ邮箱信息
    */
    
    public Map modifyQQInformation() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_acc=mapper.s_acc(params);
        SQLMap s_acc_emt=s_acc.getExistfirst();
        result.put("s_acc", s_acc_emt);
        
        return result;
    }
    /**
    新邮件修改
    */
    
    public Map newEmailSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        send_mail();
        insert_mail("ts_account",context.getSession().getAttribute("login_user_id"));
        
        
        result.put("actionInfo", "发送成功");
        
        return result;
    }
    /**
    */
    
    public Map d_cam() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_cam(params);
        
        return result;
    }
    /**
    发件箱修改
    */
    
    public Map sendEmailSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("mail_send")){
            params=new SQLParam(request,emt.getMap());
            mapper.mail_id(params);
        }
        
        return result;
    }
    /**
    */
    
    public Map thisjava() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        /* TODO 个人邮件接收
        */
        
        return result;
    }
    /**
    */
    
    public Map d_ss() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        for (SQLMap emt:hqlBean.getTableElements("")){
            params=new SQLParam(request,emt.getMap());
            mapper.d_ss(params);
        }
        
        return result;
    }
    /**
    邮件明细修改
    */
    
    public Map emailDetailedSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        int d_mail = mapper.d_mail(params);
        result.put("d_mail", d_mail);
        
        
        int d_mail_attach = mapper.d_mail_attach(params);
        result.put("d_mail_attach", d_mail_attach);
        
        return result;
    }
    /**
    转发邮件修改
    */
    
    public Map emailForwardSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        send_mail();
        
        return result;
    }
    /**
    */
    
    public Map d_acc() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_acc(params);
        
        return result;
    }
    /**
    增加邮箱信息修改
    */
    
    public Map increaseMailboxInformationSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int mail_account = mapper.mail_account(params);
        result.put("mail_account", mail_account);
        
        return result;
    }
    /**
    修改邮箱信息修改
    */
    
    public Map mailboxInformationUpSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int mail_account = mapper.mail_account(params);
        result.put("mail_account", mail_account);
        
        return result;
    }
    /**
    修改授权码修改
    */
    
    public Map modifyAuthorizationSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int mail_account = mapper.mail_account(params);
        result.put("mail_account", mail_account);
        
        return result;
    }
    /**
    修改QQ邮箱信息修改
    */
    
    public Map modifyQQInformationSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int mail_account = mapper.mail_account(params);
        result.put("mail_account", mail_account);
        
        return result;
    }
}